import type { ComponentsConfig, ComponentsConfigRaw } from '../../types'
import { extendSchemas } from '@/components/cms/utils'
import advsConfig from './base/advs'
import { filmRating, playCount } from './simples'

const basePath = 'template.videoSynopsis'

const config: ComponentsConfig = {
  default: 'filmRating',
  components: extendSchemas<ComponentsConfigRaw>(
    {
      filmRating: filmRating({
        pageFields: {
          background: `${basePath}.background`
        },
        fields: {
          fill: `${basePath}.content.score.fill`,
          iconStyle: `${basePath}.content.score.iconStyle`,
          color: `${basePath}.content.score.color`
        }
      }),
      playCount: playCount({
        pageFields: {
          background: `${basePath}.background`
        },
        fields: {
          enable: `${basePath}.content.viewCounts.enable` as unknown as boolean,
          background: `${basePath}.content.viewCounts.background`
        }
      })
    },
    advsConfig(['playerBeforeAdv', 'playerPauseAdv'])
  )
}
export default config
